package demo_0324;

public class HourlyEmployee extends Employee{
    private int hours;
    private double hourlySalary;
    public HourlyEmployee(String name, int age, int hours, double hourlySalary) {
        super(name, age);
        this.hours = hours;
        this.hourlySalary = hourlySalary;
    }
    @Override
    public double weeklySalary() {
        if (hours <= 40) {
            return hours * hourlySalary;
        } else {
            return 40 * hourlySalary + (hours - 40) * hourlySalary * 1.5;
        }
    }
}
